<template>
    <el-select v-model="supplier" collapse-tags :disabled="disable" :multiple="multiple" :placeholder="placeholder"
        @change="handleChange" @visible-change="handleVisibleChange">
        <el-option v-for="item in options" :key="item.value" :disabled="item.disable" :label="item.label"
            :value="item.value">
        </el-option>
    </el-select>
</template>
<script>
export default {
    name: "CommonSelect",
    props: {
        disable: {
            type: Boolean,
            default: false,
        },
        // 传入的数据，必填
        value: {
            type: [String, Number, Array],
            default: "",
        },
        options: {
            type: Array,
            default: () => {
                return [];
            },
        },
        placeholder: {
            type: String,
            default: "请选择",
        },
        // 是否多选
        multiple: {
            type: Boolean,
            default: false,
        },
    },
    computed: {
        supplier: {
            get() {
                return this.value;
            },
            set(v) {
                this.$emit("input", v);
            },
        },
    },
    methods: {
        handleChange(val) {
            this.$emit("change", val);
        },
        handleVisibleChange(val) {
            this.$emit("visibleChange", val);
        },
    },
};
</script>



<style lang="less" scoped>
.el-select {
    height: 32px;
    // margin-left: 10px;
    width: 220px;

    ::v-deep(.el-input__inner) {
        border-radius: 2px;
        height: 32px;
        line-height: 32px;
    }

    ::v-deep(.el-input__suffix) {
        display: grid;
        place-content: center;
    }

    ::v-deep(.el-range-editor.is-active,
        .el-range-editor.is-active:hover,
        .el-select .el-input.is-focus .el-input__inner) {
        border-color: #155BD4;
    }
}
</style>
